﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/ChargeNurse/ChargeNurse.master"
    AutoEventWireup="true" CodeFile="Yeucau.aspx.cs" Inherits="Management_ChargeNurse_Yeucau" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="../DanhSachThuoc.ascx" TagName="DanhSachThuoc" TagPrefix="uc1" %>
<%@ Register Src="../Danhsachnhanvien.ascx" TagName="Danhsachnhanvien" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <style type="text/css">
        .tbHeader
        {
            vertical-align: middle;
            text-align: left;
            border: 1px;
            height: 40px;
        }
        .tbCell
        {
            vertical-align: middle;
            text-align: left;
            height: 20px;
            border: 1px;
        }
        .test
        {
            border: 1px solid #0000B0;
            border-collapse: collapse;
            padding: 5px;
        }
        .test td
        {
            vertical-align: top;
            padding: 5px;
        }
    </style>
    <div>
        <table class="test">
            <tr>
                <td>
                    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2" Height="300px"
                        Width="938px" OnActiveTabChanged="TabContainer1_ActiveTabChanged" AutoPostBack="true">
                        <cc1:TabPanel runat="server" HeaderText="Danh sách các yêu cầu" ID="TabPanel1">
                            <ContentTemplate>
                                <table>
                                    <tr>
                                        <td>
                                            <asp:Panel ID="Panel1" runat="server" Width="465px" Height="279px" Style="overflow: scroll"
                                                ScrollBars="Vertical">
                                                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                                                    DataSourceID="danhsachyeucau" Width="441px" ShowHeaderWhenEmpty="True" CellPadding="4"
                                                    ForeColor="#333333" GridLines="None">
                                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                    <Columns>
                                                        <asp:BoundField DataField="ID" HeaderText="Mã yêu cầu" InsertVisible="False" ReadOnly="True"
                                                            SortExpression="ID">
                                                            <HeaderStyle CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="IDStaff" HeaderText="IDStaff" SortExpression="IDStaff"
                                                            Visible="False">
                                                            <HeaderStyle Height="30px" CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="RequisitionDate" DataFormatString="{0: dd-MM-yyyy}" HeaderText="Ngày yêu cầu"
                                                            SortExpression="RequisitionDate">
                                                            <HeaderStyle Height="30px" CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:BoundField>
                                                        <asp:TemplateField HeaderText="Tình trạng" SortExpression="Accepted">
                                                            <ItemTemplate>
                                                                <asp:Label ID="Label1" runat="server" Text='<%# status[(int)Eval("Accepted")] %>'></asp:Label>
                                                            
</ItemTemplate>

<HeaderStyle Height="30px" CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:TemplateField>
                                                        <asp:TemplateField><ItemTemplate>
                                                                <asp:LinkButton ID="lbChitiet" runat="server" OnClick="XemchitietYeucau" CommandArgument='<%# Eval("ID")%>'
                                                                    Text="Chi tiết" CausesValidation="false"></asp:LinkButton>
                                                            
</ItemTemplate>

<HeaderStyle CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:TemplateField>
                                                    </Columns>
                                                    <EditRowStyle BackColor="#999999" />
                                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                    <SelectedRowStyle BackColor="#E2DED6" ForeColor="#333333" Font-Bold="True" />
                                                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                                </asp:GridView>
                                            </asp:Panel>
                                            <asp:SqlDataSource ID="danhsachyeucau" runat="server" ConnectionString="Data Source=ATKT\SQLEXPRESS;Initial Catalog=HOSPITALMANAGEMENT;Persist Security Info=True;User ID=sa;Password=vinamilk"
                                                ProviderName="System.Data.SqlClient" SelectCommand="SELECT [IDStaff], [RequisitionDate], [ID], [DateReceive], [IDStaffReceive], [Accepted] FROM [tbRequisition] WHERE ([IDStaff] = @IDStaff) ORDER BY [RequisitionDate]">
                                                <SelectParameters>
                                                    <asp:FormParameter FormField="IDStaff" Name="IDStaff" Type="Int32" />
                                                </SelectParameters>
                                            </asp:SqlDataSource>
                                        </td>
                                        <td>
                                            <asp:Panel ID="pnChitiet" runat="server" Visible="False">
                                                <asp:Panel ID="ke" runat="server" Width="435px" Height="268px" ScrollBars="Vertical"
                                                    Style="overflow: scroll">
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <asp:Label ID="lbYeucauInfo" runat="server" Text="Yêu cầu "></asp:Label>
                                                                <asp:Label ID="lbMaYeucau" runat="server"></asp:Label>
                                                                <asp:GridView ID="GridView2" runat="server" Width="400px" AutoGenerateColumns="False"
                                                                    DataSourceID="chitietyeucau" BackColor="LightGoldenrodYellow" BorderColor="Tan"
                                                                    BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None">
                                                                    <AlternatingRowStyle BackColor="PaleGoldenrod" />
                                                                    <Columns>
                                                                        <asp:BoundField DataField="IDRequisition" HeaderText="IDRequisition" SortExpression="IDRequisition"
                                                                            Visible="False">
                                                                            <HeaderStyle CssClass="tbHeader" />
                                                                            <ItemStyle CssClass="tbCell" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="Name" HeaderText="Tên thuốc" SortExpression="Name" HtmlEncode="False">
<HeaderStyle CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:BoundField>
                                                                        <asp:BoundField DataField="Quantity" HeaderText="Số lượng" SortExpression="Quantity">
<HeaderStyle CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:BoundField>
                                                                        <asp:BoundField DataField="UnitType" HeaderText="Đơn vị tính" SortExpression="UnitType">
                                                                            <HeaderStyle CssClass="tbHeader" />
                                                                            <ItemStyle CssClass="tbCell" />
                                                                        </asp:BoundField>
                                                                    </Columns>
                                                                    <FooterStyle BackColor="Tan" />
                                                                    <HeaderStyle BackColor="Tan" Font-Bold="True" />
                                                                    <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                                                                    <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                                                                    <SortedAscendingCellStyle BackColor="#FAFAE7" />
                                                                    <SortedAscendingHeaderStyle BackColor="#DAC09E" />
                                                                    <SortedDescendingCellStyle BackColor="#E1DB9C" />
                                                                    <SortedDescendingHeaderStyle BackColor="#C2A47B" />
                                                                </asp:GridView>
                                                                <asp:SqlDataSource ID="chitietyeucau" runat="server" ConnectionString="Data Source=ATKT\SQLEXPRESS;Initial Catalog=HOSPITALMANAGEMENT;Persist Security Info=True;User ID=sa;Password=vinamilk"
                                                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT tbDrug.[Name], tbDrug.[UnitType], tbRequisitionDetail.[IDRequisition], tbRequisitionDetail.[IDDrug], tbRequisitionDetail.[Quantity] FROM [tbRequisitionDetail], [tbDrug] WHERE (tbRequisitionDetail.[IDRequisition] = @IDRequisition AND tbDrug.[ID]=tbRequisitionDetail.[IDDrug])">
                                                                    <SelectParameters>
                                                                        <asp:FormParameter FormField="IDRequisition" Name="IDRequisition" Type="Int32" />
                                                                    </SelectParameters>
                                                                </asp:SqlDataSource>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Panel runat="server" ID="pnNguoinhan">
                                                                    <table>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Label ID="Label4" runat="server" Text="Người nhận"></asp:Label>
                                                                            </td>
                                                                            <td>
                                                                                <uc2:Danhsachnhanvien ID="Danhsachnhanvien1" runat="server" />
                                                                            </td>
                                                                            <td>
                                                                                <asp:Button ID="btNguoinhan" runat="server" Text="Giao nhiệm vụ" OnClick="btNguoinhan_Click" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </asp:Panel>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Panel runat="server" ID="pnNgaynhan">
                                                                    <table>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Label ID="Label7" runat="server" Text="Ngày nhận"></asp:Label>
                                                                            </td>
                                                                            <td>
                                                                                <asp:Label ID="lbNgaynhan" runat="server"></asp:Label>
                                                                            </td>
                                                                            <td>
                                                                                <asp:Button ID="btNgaynhan" runat="server" Text="Xác nhận" OnClick="btNgaynhan_Click" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </asp:Panel>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Panel runat="server" ID="pnNhanthatbai">
                                                                    <table>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Label ID="Label6" runat="server" Text="Yêu cầu không được chấp nhận"></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Label ID="Label8" runat="server" Text="Lý do"></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:TextBox ID="tbLydo" runat="server" TextMode="MultiLine" Height="85px" Width="400px"></asp:TextBox>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </asp:Panel>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                                <asp:Button ID="btClose" runat="server" Text="Đóng lại" OnClick="closePanel" CausesValidation="False" />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </cc1:TabPanel>
                        <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Lập yêu cầu mới">
                            <HeaderTemplate>
                                Lập yêu cầu mới
                            </HeaderTemplate>
                            <ContentTemplate>
                                <table style="height: 292px; width: 920px;" cellpadding="5px">
                                    <tr>
                                        <td colspan="2">
                                            <asp:Panel ID="Panel2" runat="server" Width="460px" Height="247px" Style="overflow: scroll"
                                                ScrollBars="Vertical">
                                                <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                                    ForeColor="#333333" GridLines="None" Width="433px" ShowHeaderWhenEmpty="True">
                                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                    <Columns>
                                                        <asp:BoundField HeaderText="Tên vật tư" DataField="Tenthuoc">
                                                            <HeaderStyle CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:BoundField>
                                                        <asp:BoundField HeaderText="Số lượng" DataField="Soluong">
<HeaderStyle CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:BoundField>
                                                        <asp:BoundField HeaderText="Đơn vị tính" DataField="Donvitinh">
<HeaderStyle CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:BoundField>
                                                        <asp:TemplateField><ItemTemplate>
                                                                <asp:LinkButton runat="server" Text="Xóa" OnClick="XoaThuoc" CommandArgument='<%# Eval("ID") %>'
                                                                    CausesValidation="false">
                                                                </asp:LinkButton>
                                                            
</ItemTemplate>

<HeaderStyle CssClass="tbHeader" />

<ItemStyle CssClass="tbCell" />
</asp:TemplateField>
                                                    </Columns>
                                                    <EditRowStyle BackColor="#999999" />
                                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                                </asp:GridView>
                                            </asp:Panel>
                                        </td>
                                        <td style="vertical-align: top">
                                            <table>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label2" runat="server" Text="Tên vật tư"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <uc1:DanhSachThuoc ID="liThuoc" runat="server" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label3" runat="server" Text="Số lượng"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="tbSoluong" runat="server" Height="22px" Width="180px"></asp:TextBox>
                                                    </td>
                                                    <td>
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbSoluong"
                                                            ForeColor="Red">*</asp:RequiredFieldValidator>
                                                    </td>
                                                    <td>
                                                        <asp:Button ID="btThem" runat="server" Text="Thêm" Height="28px" Width="112px" OnClick="btThem_Click" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Button ID="btReset" runat="server" OnClick="btReset_Click" Text="Làm lại" Width="80px"
                                                CausesValidation="False" />
                                        </td>
                                        <td>
                                            <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Gửi yêu cầu"
                                                Width="343px" CausesValidation="False" />
                                        </td>
                                </table>
                            </ContentTemplate>
                        </cc1:TabPanel>
                        <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
                            <HeaderTemplate>
                                Danh sách vật tư
                            </HeaderTemplate>
                            <ContentTemplate>
                                <table>
                                    <tr>
                                        <td>
                                            <asp:RadioButton ID="radio1" runat="server" Text="Thiết bị y tế" GroupName="danhsachvattu"
                                                AutoPostBack="True" OnCheckedChanged="radio1_CheckedChanged" />
                                        </td>
                                        <td>
                                            <asp:RadioButton ID="radio2" runat="server" Text="Thuốc" GroupName="danhsachvattu"
                                                AutoPostBack="True" OnCheckedChanged="radio2_CheckedChanged" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:Panel runat="server" Height="256px" ScrollBars="Vertical" Style="overflow: scroll">
                                                <asp:GridView ID="gvDanhsachvattu" runat="server" Width="461px" AutoGenerateColumns="False"
                                                    DataKeyNames="Name,Quantity,UnitType" DataSourceID="vattuDS" ShowHeaderWhenEmpty="True"
                                                    CellPadding="4" ForeColor="#333333" GridLines="None">
                                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                    <Columns>
                                                        <asp:TemplateField HeaderText="Tên" SortExpression="Name">
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="Label1" runat="server" Text='<%# Bind("Name") %>' OnClick="Xemvattu"
                                                                    CommandArgument='<%# Eval("ID") %>' CausesValidation="false"></asp:LinkButton>
                                                            </ItemTemplate>
                                                            <HeaderStyle CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:TemplateField>
                                                        <asp:BoundField DataField="Quantity" HeaderText="Số lượng" SortExpression="Quantity">
                                                            <HeaderStyle CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="UnitType" HeaderText="Đơn vị tính" SortExpression="UnitType">
                                                            <HeaderStyle CssClass="tbHeader" />
                                                            <ItemStyle CssClass="tbCell" />
                                                        </asp:BoundField>
                                                    </Columns>
                                                    <EditRowStyle BackColor="#999999" />
                                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                                </asp:GridView>
                                                <asp:SqlDataSource ID="vattuDS" runat="server" ConnectionString="Data Source=ATKT\SQLEXPRESS;Initial Catalog=HOSPITALMANAGEMENT;Persist Security Info=True;User ID=sa;Password=vinamilk"
                                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT tbDrug.[ID], tbDrug.[Name], tbWardDrug.[Quantity], tbDrug.[UnitType] FROM tbWardDrug INNER JOIN tbDrug ON tbWardDrug.[IDDrug]=tbDrug.[ID] WHERE tbWardDrug.[IDWard]=@IDWard AND tbDrug.[Type]=@Type">
                                                    <SelectParameters>
                                                        <asp:FormParameter FormField="IDWard" Name="IDWard" Type="Int32" />
                                                        <asp:FormParameter FormField="Type" Name="Type" Type="Int32" />
                                                    </SelectParameters>
                                                </asp:SqlDataSource>
                                            </asp:Panel>
                                        </td>
                                        <td style="vertical-align: top">
                                            <asp:Panel runat="server" ID="pnChitietvattu" Visible="False">
                                                <asp:Panel ID="Panel3" runat="server" Height="226px" Width="430px">
                                                    <table class="test" width="100%" cellpadding="5px">
                                                        <tr>
                                                            <td>
                                                                <asp:Label ID="Label9" runat="server" Text="Tên"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lbName" runat="server"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Label ID="Label11" runat="server" Text="Đơn vị tính"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lbUnitType" runat="server"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Label ID="Label13" runat="server" Text="Cách dùng"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lbUseMethod" runat="server"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Label ID="Label5" runat="server" Text="Giá"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lbCost" runat="server"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:Label ID="Label16" runat="server" Text="Mô tả"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="tbDesc" runat="server" Height="114px" TextMode="MultiLine" Width="290px"
                                                                    ReadOnly="True"></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                                <asp:Button ID="btCloseVt" Text="Đóng lại" runat="server" OnClick="btCloseVt_Click"
                                                    Style="height: 26px" CausesValidation="False" />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </cc1:TabPanel>
                    </cc1:TabContainer>
                </td>
            </tr>
        </table>
    </div>
    <div>
    </div>
</asp:Content>
